import request from '@/utils/request'
// 获取员工简单列表
const simpleUser = () => request({ url: '/sys/user/simple' })
// 删除员工
const delEmp = id => request({ url: `/sys/user/${id}`, method: 'delete' })
// 新增员工
const addEmp = data =>
  request({
    url: '/sys/user',
    method: 'post',
    data
  })
// 批量导入员工
const imEmp = data => request({ url: '/sys/user/batch', method: 'post', data })
// 保存员工基本信息
const saveBaseInfo = data =>
  request({ url: `/sys/user/${data.id}`, method: 'put', data })
// 获取员工的基本信息
const getBaseInfo = id => request({ url: `/sys/user/${id}` })
// 获取员工的岗位信息
const getJobInfo = id => request({ url: `/employees/${id}/jobs` })
// 保存员工的岗位信息
const saveJobInfo = data =>
  request({ url: `/employees/${data.id}/jobs`, method: 'put', data })
// 给员工分配角色
const setRoles = data =>
  request({ url: '/sys/user/assignRoles', method: 'put', data })
// 暴露
export {
  simpleUser,
  delEmp,
  addEmp,
  imEmp,
  saveBaseInfo,
  getBaseInfo,
  getJobInfo,
  saveJobInfo,
  setRoles
}
